package com.whcoding.designpatterns.pattern.chainofresponsibility.validate;

import com.whcoding.designpatterns.pattern.chainofresponsibility.handler.LoginHandler;
import com.whcoding.designpatterns.pattern.chainofresponsibility.vo.UserVO;
import org.apache.commons.lang3.StringUtils;

/**
 * @program: spring-boot-learning
 * @description: 检查用户名称以及用户密码是否为空
 * @author: whcoding
 * @create: 2022-09-19 14:27
 **/
public class ValidateParamHandler extends LoginHandler{

	@Override
	public void doHandler(UserVO member) {
		if (StringUtils.isEmpty(member.getUserName()) ||
				StringUtils.isEmpty(member.getPassword())) {
			System.out.println("用户名和密码不能为空");
			return;
		}
		if (null != next) {
			next.doHandler(member);
		}
	}
}
